<template>
	<view>
			<view>
				<uni-grid :column="2" :show-border="false" :square="false">
					<uni-grid-item><uni-tag text="同城帮买" :type="typeIndex == 0 ? 'error' : 'default'" :circle="true" :inverted='true' @click="tobuy"></uni-tag></uni-grid-item>
					<uni-grid-item><uni-tag text="同城急送" :type="typeIndex == 1 ? 'error' : 'default'" :circle="true" :inverted='true' @click=""></uni-tag></uni-grid-item>
				</uni-grid> 
			</view>
			<map class="map" :longitude="lon" :latitude="lat" :markers="markers" scale="15"></map>
	</view>
</template>

<script>
	import uniGrid from '../../components/uni-grid/uni-grid.vue';
	import uniGridItem from '../../components/uni-grid-item/uni-grid-item.vue';
	import uniTag from '../../components/uni-tag/uni-tag.vue';
	import { navigation } from '../../unitl/navigation.js';
	export default {
		components:{uniGrid,uniGridItem,uniTag},
		data() {
			return {
			typeIndex:1,
				isget:1,
			istoNewPage:false,
			lon:'104.063491',
			lat:'30.572932',
			markers:[
				{
					longitude:'104.063491',
					latitude:'30.572932',
					iconPath:'../../static/z-picture/qizhi.png',
					width:50,
					height:50
				}
			],
			addressData:[],
			addressDataCopy:[]
		}	
	},
	methods:{
		tobuy(){
			uni.navigateTo({
				url:"flashex"
			})
		}
	},
	onLoad() {
		const buttowNavi=uni.getSubNVueById('buttowNavi');
		const flashadress=uni.getSubNVueById('flashadress');
		flashadress.show()
		buttowNavi.setStyle({
			top:'700px'
		})
		buttowNavi.show()
		flashadress.setStyle({
			top:'470px',
			height:'200px',
			left:'10px',
			right:'10px'
		})
	},
	onShow(){
		//console.log(this.istoNewPage)
		if(this.istoNewPage){
			this.istoNewPage=false;
			if(this.addressDataCopy.length==0){
				this.isget=0
			}
			var params = {
			    r_siteDetails : this.addressDataCopy.siteDetails,
			     r_siteNote :this.addressDataCopy.siteNote,
				 r_siteName :this.addressDataCopy.siteName,
				 r_siteTelephone : this.addressDataCopy.siteTelephone,
				 r_lon : this.addressDataCopy.lon,
				 r_lat : this.addressDataCopy.lat,
				 r_aid:this.addressDataCopy.aid,
				 g_siteDetails : this.addressData.siteDetails,
				 g_siteNote : this.addressData.siteNote,
				 g_siteName : this.addressData.siteName,
				 g_siteTelephone : this.addressData.siteTelephone,
				 g_lon : this.addressData.lon,
				g_lat : this.addressData.lat,
				 g_aid:this.addressData.aid,
				toget:this.isget
			}
			//console.log(params)
			navigation('./flashexsenddetail',params)
			//console.log(res)
			/* uni.navigateTo({
				url:''
			}) */
		}
		//给子窗体传值
		if(this.addressDataCopy!=''){
			var adc=this.addressDataCopy;
			uni.$emit('copy',{
				data:adc
			})
		}
		if(this.addressData!=''){
			var adc=this.addressData;
			uni.$emit('address',{
				data:adc
			})
		}
		
	}
	}
</script>

<style lang="scss">
	.map{
		width: 750rpx;
		height: 1400rpx;
	}
</style>

